home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld: Complete Mac Interactive
/
Macworld Complete Mac Interactive CD)(1994).iso
/
The Best of BMUG
/
Utilities
/
Text and Speech
/
Alpha.5.76
/
Tcl
/
SystemCode
/
win.tcl
< prev
Wrap
Text File
|
1994-03-08
|
3KB
|
151 lines
#=============================================================================
# Window handling routines. All procs are bound in AlphaBits.tcl.
#=============================================================================
proc shrinkHigh {} {
set text [getGeometry]
set left [lindex $text 0]
set top [lindex $text 1]
set width [lindex $text 2]
sizeWin $width 150
moveWin $left 42
}
proc shrinkLow {} {
set text [getGeometry]
set left [lindex $text 0]
set top [lindex $text 1]
set width [lindex $text 2]
moveWin $left 330
sizeWin $width 146
}
proc swapWithNext {} {
set files [winNames -f]
set len [llength $files]
if {$len <= 1} return
bringToFront [lindex $files 1]
}
proc nextWindow {} {
set files [winNames -f]
if {[llength $files] <= 1} return
sendToBack [lindex $files 0]
}
proc prevWindow {} {
set files [winNames -f]
set len [llength $files]
if {$len <= 1} return
bringToFront [lindex $files [expr $len-1]]
}
proc dispFullName {} {
message [lindex [winNames -f] 0]
}
proc vertically {} {
global tileHeight
global tileWidth
global numWinsToTile
set margin 22
set names [winNames -f]
set numWins [llength $names]
if ($numWins<=1) return
if ($numWins>$numWinsToTile) {set numWins $numWinsToTile}
set height [expr ($tileHeight/$numWins)-$margin]
set height [expr {$height + $margin / $numWins}]
set width $tileWidth
set ver 40
if {$numWins == 0} {return}
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] 1000 0
sizeWin [lindex $names $i] $width $height
}
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] 3 $ver
set ver [expr $ver+$margin+$height]
}
}
proc horizontally {} {
global tileHeight
global tileWidth
global numWinsToTile
set names [winNames -f]
set numWins [llength $names]
if ($numWins<=1) return
if ($numWins>$numWinsToTile) {set numWins $numWinsToTile}
set margin 4
set width [expr ($tileWidth/$numWins)-$margin]
set width [expr {$width + $margin / $numWins}]
set height $tileHeight
set hor 0
if {$numWins == 0} {return}
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] 1000 0
sizeWin [lindex $names $i] $width $height
}
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] $hor 40
set hor [expr $hor+$width+$margin]
}
}
proc tiled {} {
global tileHeight
global tileWidth
global numWinsToTile
set xPan 8
set yPan 10
set xMarg 3
set yMarg 40
set yMax 50
set names [winNames -f]
set numWins [llength $names]
if ($numWins<1) return
set line 0
set height [expr $tileHeight-$yPan*($numWins-1)]
set width [expr $tileWidth-$xPan*($numWins-1)]
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] [expr $xMarg+$i*$xPan] [expr $yMarg+$line]
set line [expr $line+$yPan]
if ($line>$yMax) {set line 0}
sizeWin [lindex $names $i] $width $height
}
}
proc overlay {} {
global defHeight
global defWidth
global numWinsToTile
set names [winNames -f]
set numWins [llength $names]
if ($numWins<1) return
for {set i 0} {$i < $numWins} {incr i} {
moveWin [lindex $names $i] 3 40
sizeWin [lindex $names $i] $defWidth $defHeight
}
}
proc chooseAWindow {} {
set name [listpick [lsort [winNames]]]
if {[string length $name]} {
bringToFront $name
if [icon -q] { icon -f $name -o }
}
}
proc iconify {} {
icon -t
}